@extends('layouts.app')

@section('content')
    <div class="content">
        <div class="header">
            <ul class="breadcrumb">
                <li><i class="fa fa-fw fa-cog"></i>单位管理</li>
                <li>单位列表</li>
            </ul>
        </div>
        <div class="main-content">
            <div class="btn-toolbar list-toolbar">
                <a href="{{url('admin/units/zeren')}}" class="btn btn-warning add-user">返回上级</a>
                <div class="form-all">
                    <table class="table table-form table-striped table-bordered table-condensed">
                        <thead>
                        <tr>
                            <th width="80">序号</th>
                            <th>单位名</th>
                            <th>所属组织</th>
                            <th>修改时间</th>
                            <th>操作人</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach ($res as $key=>$re)
                            <tr>
                                <td>{{ $key+1 }}</td>
                                <td><span style="color:#ec971f">{{ $re->name }}</span></td>
                                <td>@if($re->org_id == '' )暂无@else<span style="color:#4cae4c">{{ getValue($re->org_id,'org','id','name') }}</span>@endif</td>
                                <td><span style="color:#ec971f">{{ $re->updated_at }}</span></td>
                                <td><span style="color:#599de6">{{ getValue($re->user_id,'admin_users','id','name') }}</span></td>
                                <td>
                                    <a href="{{url('admin/units/edit',$re->id)}}" class="label label-success tag">编辑</a>
                                    <a href="{{url('admin/units/del',$re->id)}}" class="label label-warning tag del">注销</a>
                                    @if($re->org_id == '' )
                                        <a href="{{url('admin/units/renling',$re->id)}}" class="label label-success tag renling">认领</a>
                                    @else
                                        <a href="{{url('admin/units/shifang',$re->id)}}" class="label label-warning tag shifang">释放</a>
                                    @endif
                                    @if($re->is_imp == '0')
                                        <a href="{{url('admin/units/swzd',$re->id)}}" class="label label-success tag swzd">设为重点</a>
                                    @elseif($re->is_imp == '1')
                                        <a href="{{url('admin/units/qxzd',$re->id)}}" class="label label-warning tag qxzd">取消重点</a>
                                    @endif
                                    <a href="{{url('admin/units/faren',$re->id)}}" class="label label-warning tag">法人</a>
                                    <a href="{{url('admin/units/baowei',$re->id)}}" class="label label-warning tag">保卫人员</a>
                                    <a href="{{url('admin/units/zybw',$re->id)}}" class="label label-warning tag">重要部位</a>
                                    <a href="{{url('admin/units/zdry',$re->id)}}" class="label label-warning tag">重点人员</a>
                                    <a href="{{url('admin/units/tfsj',$re->id)}}" class="label label-warning tag">突发事件处置预案</a>
                                    <a href="{{url('admin/units/zdqk',$re->id)}}" class="label label-warning tag">重大情况报告</a>
                                    <a href="{{url('admin/units/history',$re->id)}}" class="label label-warning tag">历史变更记录</a>
                                </td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
                <span>共{{$count}}条数据</span>
                <ul class="pagination pull-right">
                    {{ $res->render() }}
                </ul>
            </div>
        </div>
    </div>

    <script type="text/javascript">
        function check() {
            $('#search_form').submit();
        }

        $('.del').click(function(){
            var i=window.confirm("确认注销该单位？");
            if(i==0){
                return false;
            }
        });
        $('.swzd').click(function(){
            var i=window.confirm("确认设置为重点单位？");
            if(i==0){
                return false;
            }
        });
        $('.qxzd').click(function(){
            var i=window.confirm("确认取消重点单位？");
            if(i==0){
                return false;
            }
        });
        $('.renling').click(function(){
            var i=window.confirm("确认认领该单位？");
            if(i==0){
                return false;
            }
        });
        $('.shifang').click(function(){
            var i=window.confirm("确认释放该单位？");
            if(i==0){
                return false;
            }
        });
    </script>
@stop

